package librss;
import java.io.*;
import java.net.*;
import java.util.Scanner;
/*
 * DownloadPage.java
 *
 * Created on March 7, 2009, 12:28 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author alvaro
 */
class DownloadPage {
    
    /** Creates a new instance of DownloadPage */
    public DownloadPage() {
    }
    
    public static void download(String url, String destFile) throws MalformedURLException, IOException{
        URLConnection connect = new URL(url).openConnection();
        InputStream is = connect.getInputStream();
        PrintWriter pw = new PrintWriter(new FileWriter(new File(destFile)));
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        
        String line = null;
        while((line = br.readLine()) != null){
            pw.println(line);
        }
        
        pw.flush();
        pw.close();
        br.close();
        
    }
}
